//
//  TuijianCell.m
//  
//
//  Created by 郭明皓 on 15/10/23.
//
//

#import "TuijianCell.h"
#define WIDTH self.backgroundViews.frame.size.width
#define HEIGHT self.backgroundViews.frame.size.height
#import "DKNightVersion.h"
@implementation TuijianCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc
{
    [_leftimageView release];
    [_title release];
    [_describe release];
    [_money release];
    [_normalMoney release];
    [_sell release];
    [_backgroundViews release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if ( self) {
        [self create];
    }
    return self;
}
- (void)create
{
    [DKNightVersionManager addClassToSet:self.class];
    self.nightBackgroundColor = UIColorFromRGB(0x343434);
    
    self.backgroundViews = [[UIView alloc]init];
    [self.contentView addSubview:self.backgroundViews];
    [self.backgroundViews release];
    
    
    
    self.leftimageView = [[UIImageView alloc]init];
    [self.backgroundViews addSubview: self.leftimageView];
    [self.leftimageView release];
    self.leftimageView.layer.cornerRadius = 10;
    self.leftimageView.layer.masksToBounds = YES;
    
    self.title = [[UILabel alloc]init];
    [self.backgroundViews addSubview: self.title];
    [self.title release];
    self.title.textColor = [UIColor darkGrayColor];
    
    self.describe = [[UILabel alloc]init];
    [self.backgroundViews addSubview: self.describe];
    [self.describe release];
    self.describe.numberOfLines = 2;
    self.describe.font = [UIFont systemFontOfSize:12];
    self.describe.textColor = [UIColor darkGrayColor];
    
    self.money = [[UILabel alloc]init];
    [self.backgroundViews addSubview: self.money];
    [self.money release];
    self.money.textColor = [UIColor redColor];
    
    self.normalMoney = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.normalMoney];
    [self.normalMoney release];
    self.normalMoney.font = [UIFont systemFontOfSize:12];
    self.normalMoney.textColor = [UIColor darkGrayColor];
    
    self.sell = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.sell];
    [self.sell release];
    self.sell.textAlignment = NSTextAlignmentRight;
    self.sell.font = [UIFont systemFontOfSize:12];
    self.sell.textColor = [UIColor darkGrayColor];
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.backgroundViews.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 10);
    self.leftimageView.frame = CGRectMake(0, 0, WIDTH / 3, HEIGHT);
    self.title.frame = CGRectMake(WIDTH / 3 + 5, 0, WIDTH / 3 * 2 - 5, HEIGHT / 5);
    self.describe.frame = CGRectMake(WIDTH / 3 + 5, HEIGHT / 5, WIDTH / 3 * 2 - 5, HEIGHT / 3);
    self.money.frame = CGRectMake(WIDTH / 3 + 5, HEIGHT / 5 * 4, 60, HEIGHT / 5);
    self.normalMoney.frame = CGRectMake(WIDTH / 3 + 70, HEIGHT / 5 * 4, 40, HEIGHT / 5);
    self.sell.frame = CGRectMake(WIDTH / 3 * 2 + 20, HEIGHT / 5 * 4, WIDTH / 3 - 20, HEIGHT/ 5);
}
@end
